package com.hxzy.controller;

import com.hxzy.common.enums.AckCode;
import com.hxzy.common.web.resp.R;
import com.hxzy.module.admin.AdminFeignClient;
import com.hxzy.module.admin.resp.AccountDetailResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@Api(tags = "总部后台-账户相关的Api")
@RequestMapping(value = "/admin-feign")
@RestController
@Log4j2
public class FeignAdminController {


    @Autowired
    private AdminFeignClient adminFeignClient;

    @ApiOperation(value = "根据id查询")
    @GetMapping(value = "/account/{id}")
    public R<AccountDetailResp> adminAccountFindById(@PathVariable(value = "id") String accountId){
        R<AccountDetailResp> r = this.adminFeignClient.adminAccountFindById(accountId);
        if(r.getCode().intValue()== AckCode.SUCCESS.getCode()){
            //做事情
            AccountDetailResp data = r.getData();
            log.info( data.getStoreId());
            log.info(data.getAccountId());
        }

        return r;
    }



}
